package com.boot.config;

import com.boot.interceptor.SimpleAuthenticationInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author Chunsheng.Zhang
 * @date 2021/4/8 11:31
 * @description : TODO
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {


    @Autowired
    private SimpleAuthenticationInterceptor simpleAuthenticationInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(simpleAuthenticationInterceptor) //注册拦截器
                .addPathPatterns("/user/**")  //添加拦截路径
                .excludePathPatterns("/login","/test");  //排除拦截路径
    }
}
